=over

=item glob EXPR
X<glob> X<wildcard> X<filename, expansion> X<expand>

=item glob

In list context, returns a (possibly empty) list of filename expansions on
the value of EXPR such as the standard Unix shell F</bin/csh> would do.  In
scalar context, glob iterates through such filename expansions, returning
undef when the list is exhausted.  This is the internal function
implementing the C<< <*.c> >> operator, but you can use it directly.  If
EXPR is omitted, L<C<$_>|perlvar/$_> is used.  The C<< <*.c> >> operator
is discussed in more detail in L<perlop/"I/O Operators">.

Note that L<C<glob>|/glob EXPR> splits its arguments on whitespace and
treats
each segment as separate pattern.  As such, C<glob("*.c *.h")>
matches all files with a F<.c> or F<.h> extension.  The expression
C<glob(".* *")> matches all files in the current working directory.
If you want to glob filenames that might contain whitespace, you'll
have to use extra quotes around the spacey filename to protect it.
For example, to glob filenames that have an C<e> followed by a space
followed by an C<f>, use one of:

    my @spacies = <"*e f*">;
    my @spacies = glob '"*e f*"';
    my @spacies = glob q("*e f*");

If you had to get a variable through, you could do this:

    my @spacies = glob "'*${var}e f*'";
    my @spacies = glob qq("*${var}e f*");

If non-empty braces are the only wildcard characters used in the
L<C<glob>|/glob EXPR>, no filenames are matched, but potentially many
strings are returned.  For example, this produces nine strings, one for
each pairing of fruits and colors:

    my @many = glob "{apple,tomato,cherry}={green,yellow,red}";

This operator is implemented using the standard C<File::Glob> extension.
See L<File::Glob> for details, including
L<C<bsd_glob>|File::Glob/C<bsd_glob>>, which does not treat whitespace
as a pattern separator.

If a C<glob> expression is used as the condition of a C<while> or C<for>
loop, then it will be implicitly assigned to C<$_>.  If either a C<glob>
expression or an explicit assignment of a C<glob> expression to a scalar
is used as a C<while>/C<for> condition, then the condition actually
tests for definedness of the expression's value, not for its regular
truth value.

Portability issues: L<perlport/glob>.

=back